import '../justfiles/go.just'

# Build ldflags string
_VERSION_META_STR := if VERSION_META != "" { "+" + VERSION_META } else { "" }
_LDFLAGSSTRING := "'" + trim(
    "-X main.GitCommit=" + GITCOMMIT + " " + \
    "-X main.GitDate=" + GITDATE + " " + \
    "-X github.com/ethereum-optimism/optimism/op-challenger/version.Version=" + VERSION + " " + \
    "-X github.com/ethereum-optimism/optimism/op-challenger/version.Meta=" + _VERSION_META_STR + " " + \
    "") + "'"

BINARY := "./bin/op-challenger"

# Build op-challenger binary
op-challenger: (go_build BINARY "./cmd" "-ldflags" _LDFLAGSSTRING)

# Run fuzzing tests
fuzz: (go_fuzz "FuzzKeccak" "10s" "./game/keccak/matrix")

# Clean build artifacts
clean:
    rm -f {{BINARY}}

# Run tests
test: (go_test "./...")
